home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1991 September & October
/
rerun-1991-09-10.d64
/
moon phases
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
13KB
|
384 lines
4 printchr$(142);chr$(8)"[147]":p$="menu runner":poke53264,0
8 printtab(9)"[154]please wait while data":printtab(12)"is being loaded"
12 poke53281,0:v=53248:pokev,190:pokev+1,106:pokev+2,190:pokev+3,148
16 pokev+4,234:pokev+5,106:pokev+6,234:pokev+7,148:pokev+29,15:pokev+23,15
20 poke53280,12:nm=332.195833:dn=int(nm):ky=1989
24 sd=54272:for i=sd to sd+23:poke i,0:next:poke sd+24,15:poke 788,52
28 forp1=15360 to 15422:readq1:pokep1,q1:next
32 forp2=15424 to 15486:readq2:pokep2,q2:next
36 forp3=15488 to 15550:readq3:pokep3,q3:next
40 forp4=15552 to 15614:readq4:pokep4,q4:next
44 forp5=15616 to 15678:readq5:pokep5,q5:next
48 forp6=15680 to 15742:readq6:pokep6,q6:next
52 forp7=15744 to 15806:readq7:pokep7,q7:next
56 forp8=15808 to 15870:readq8:pokep8,q8:next
60 forp9=15872 to 15934:readq9:pokep9,q9:next
64 forp10=15936 to 15998:readq10:pokep10,q10:next
68 forp11=16000 to 16062:readq11:pokep11,q11:next
72 forp12=16064 to 16126:readq12:pokep12,q12:next
76 forp13=16128 to 16190:readq13:pokep13,q13:next
80 forp14=16192 to 16254:readq14:pokep14,q14:next
84 forp15=16256 to 16318:readq15:pokep15,q15:next
88 forp16=16320 to 16382:readq16:pokep16,q16:next:goto176
92 poke v+21,0:print"[147]"
96 printtab(14)"[159]loading me[158]n[159]u":print"[144]load"chr$(34)p$chr$(34)",8"
100 poke198,4:poke631,13:poke632,82:poke633,213:poke634,13:end
104 print"[147]":pokev+21,0:poke53281,14:poke53280,14:sys64738
108 for w=1 to 1000:next w
112 poke 198,0
116 for c=1 to 10
120 get c$:if c$="[136]"then92
124 if c$="[140]"then104
128 if c$<>"[136]" and c$<>"[140]" and c$<>""then176
132 next
136 print" [146]press any key[145]"
140 for d=1 to 30
144 get d$:if d$="[136]"then92
148 if d$="[140]"then104
152 if d$<>"[136]" and d$<>"[140]" and d$<>""then176
156 next
160 print" [152]press[146] any[146] key[145]"
164 goto116
168 print"[145] [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";:return
172 printtab(8+len(s$))"[145] [157]":s$="":return
176 gosub936:poke198,0
180 pokev+21,0:md=0:l=0:y$="0":m$="0":d$="0":ah$="0":print"[147]"
184 print" year ? [156]";:y$=""
185 if xx>10 then xx=0
186 if xx>5 then print" [157]";:goto 190
188 print"[164][157]";
190 get a$
192 if a$="[136]"then92
196 if a$="[140]"then104
200 if a$=chr$(19) then176
204 if a$=chr$(20) then print:gosub936:gosub168:goto184
208 if a$=chr$(13) then print:s$=y$:gosub172:goto224
212 if a$<"0" or a$>"9" then222
216 if len(y$)>3 then222
220 print a$;:y$=y$+a$
222 xx=xx+1:goto 185
224 yy=val(y$)
228 if yy>2500 or yy<1582 then gosub168:goto184
232 gosub936
236 print" month? [156]";:m$=""
237 if xx>10 then xx=0
238 if xx>5 then print" [157]";:goto 242
240 print"[164][157]";
242 get a$
244 if a$=chr$(19) then176
248 if a$=chr$(20) then print:gosub936:gosub168:goto236
252 if a$=chr$(13) then print:s$=m$:gosub172:goto268
256 if a$<"0" or a$>"9" then266
260 if len(m$)>1 then266
264 print a$;:m$=m$+a$
266 xx=xx+1:goto 237
268 mm=val(m$)
272 ifmm<1ormm>12 then gosub168:goto236
276 if yy=1582 and mm<10 then gosub168:goto236
280 gosub936
284 print" day ?[156] ";:d$=""
285 if xx>10 then xx=0
286 if xx>5 then print" [157]";:goto 290
288 print"[164][157]";
290 get a$
292 if a$=chr$(19) then176
296 if a$=chr$(20) then print:gosub936:gosub168:goto284
300 if a$=chr$(13) then print:s$=d$:gosub172:dd=val(d$):goto324
304 if a$<"0" or a$>"9" then314
308 if len(d$)>1 then314
312 print a$;:d$=d$+a$
314 xx=xx+1:goto 285
316 if mm=2 and dd>29 then gosub168:goto284
320 goto332
324 if((yy/4=int(yy/4))and(yy/100<>int(yy/100)))or(yy/400=int(yy/400))then316
328 if mm=2 and dd>28 then gosub168:goto284
332 if(mm=4 or mm=6 or mm=9 or mm=11)and dd>30 then gosub168:goto284
336 if dd<1 or dd>31 then gosub168:goto284
340 dd=dd-1
344 if yy=1582andmm=10anddd<14thengosub168:goto284
348 gosub936
352 print" hour ?[156] ";:ah$="":ap$=""
353 if xx>8 then xx=0
354 if xx>4 then print" [157]";:goto 358
356 print"[164][157]";
358 get a$
360 a=val(a$)
364 if a$=chr$(19) then176
368 if a$=chr$(20) then print:gosub936:gosub168:goto352
372 if a$=chr$(13) then print:s$=ah$:gosub172:goto400
376 if a$="a" or a$="p" or a$="m" then384
380 if a$<"0" or a$>"9" then398
384 if len(ah$)>3 then398
388 print a$;
392 if a$<>right$(str$(a),len(a$)) then ap$=ap$+a$
396 ah$=ah$+a$
398 xx=xx+1:goto 353
400 ah=val(ah$)
404 if ah<1 or ah>12 thengosub168:goto352
408 aq$=right$(ah$,2)
412 if aq$<>ap$ then gosub168:goto352
416 if aq$<>"am" and aq$<>"pm" then gosub168:goto352
420 if ap$="am" and ah=12 then ah=0
424 if ap$="pm" and ah<12 then ah=ah+12
428 ah=ah/24
432 gosub936
436 print"[145][145][145][145]"tab(20)" moon phase: [146]":printtab(22)"working...[158]"
440 y=yy-ky:n=sgn(y):yd=y*365
448 for mn=1 to mm-1
452 dc=31
456 if mm=1 then dc=0
460 if mn=2 then dc=28
464 if mn=4 or mn=6 or mn=9 or mn=11 then dc=30
468 md=md+dc
472 next mn
476 gosub700
480 if n=0 then n=1
484 yt=abs(n*(yd+md+dd+ah-nm)+l)
488 ya=abs(n*(yd+md+dd+ah-dn)+l)
492 if yd+md+dd+ah<=nm then512
500 lm=(yt/29.53058):pf=lm-int(lm):lp=pf*29.53058
504 wn=ya/7:df=wn-int(wn):dw=(df*7)+1.01
508 goto520
512 lm=(yt/29.53058):pf=lm-int(lm):lp=29.53058-(pf*29.53058)
516 wn=ya/7:df=wn-int(wn):dw=7-(df*7)+1.01
520 b=abs(lp)*1000+.5:mp=sgn(lp)*int(b)/1000
524 if yy=ky and md+dd=dn then dw=1.01
528 if dw>8 then dw=1.01
532 if dw>5 and dw<6 then dw$=" sunday"
536 if dw>6 and dw<7 then dw$=" monday"
540 if dw>7 and dw<8 then dw$=" tuesday"
544 if dw>1 and dw<2 then dw$="wednesday"
548 if dw>2 and dw<3 then dw$="thursday"
552 if dw>3 and dw<4 then dw$=" friday"
556 if dw>4 and dw<5 then dw$="saturday"
560 gosub944
564 if mp>=1.845 and mp<=5.535 then n3=248:n4=249:n5=12:n8=6:n9=6:goto572
568 goto576
572 print""tab(20)"first crescent":gosub720
576 if mp>=5.536 and mp<=9.225 then n3=241:n4=243:n5=12:n8=14:n9=14:goto584
580 goto588
584 print""tab(20)"first quarter":gosub720
588 if mp>=9.226 and mp<=12.915 then goto596
592 goto604
596 n1=253:n2=252:n3=241:n4=243:n5=15:n6=3:n7=3:n8=3:n9=3
600 print""tab(20)"waxing gibbous":gosub720
604 if mp>=12.916 and mp<=16.605 then goto612
608 goto620
612 n1=240:n2=242:n3=241:n4=243:n5=15:n6=1:n7=1:n8=1:n9=1
616 print""tab(22)"full moon ":gosub720
620 if mp>=16.606 and mp<=20.295 then goto628
624 goto636
628 n1=240:n2=242:n3=254:n4=255:n5=15:n6=3:n7=3:n8=3:n9=3
632 print""tab(20)"waning gibbous":gosub720
636 if mp>=20.296 and mp<=23.985 then n1=240:n2=242:n5=3:n6=14:n7=14:goto644
640 goto648
644 print""tab(20)"last quarter":gosub720
648 if mp>=23.986 and mp<=27.675 then n1=250:n2=251:n5=3:n6=6:n7=6:goto656
652 goto660
656 print""tab(20)"last crescent":gosub720
660 if(mp>=27.676 and mp<=29.53)or(mp>=0and mp<=1.844)then goto668
664 goto676
668 n1=244:n2=246:n3=245:n4=247:n5=15:n6=1:n7=1:n8=1:n9=1
672 print""tab(22)"new moon ":gosub720
676 goto108
680 if n=1 then692
684 if mm>2 and mm<13 then l=l-1
688 goto696
692 if mm=1 or mm=2 then l=l-1
696 return
700 for x=yy to ky step1*sgn(ky-yy)
704 if((x/4=int(x/4))and(x/100<>int(x/100)))or(x/400=int(x/400))then l=l+1
708 next
712 if((yy/4=int(yy/4))and(yy/100<>int(yy/100)))or(yy/400=int(yy/400))then680
716 goto696
720 printtab(22)"[154]"dw$
724 poke2040,n1:poke2041,n2:poke2042,n3:poke2043,n4:pokev+21,n5:pokev+39,n6
728 pokev+40,n7:pokev+41,n8:pokev+42,n9
732 print"":printtab(16)
736 on mm goto740,768,796,796,800,840,856,856,860,861,896,924
740 if mm=1 and dd=0 then print" new year's [154]day";
741 if yy>1985 and mm=1 and(dd>13anddd<21)and dw$=" monday"then743
742 goto746
743 print" m. l. king jr.'s":printtab(23)"birthday"
744 printtab(23)"observed[145][145][145]":goto768
746 ifyy>1985andmm=1anddd=14thenprint" [154]m. l. king jr.'s":goto752
748 goto768
752 printtab(23)"birthday[145][145]"
768 if mm=2 and dd=1 then print" [154]groundhog day";
772 if yy>1865 and mm=2 and dd=11 then print" [156]lincoln's birthday";
776 if mm=2 and dd=13 then print" valentine's day";
780 if yy>1970 and mm=2 and (dd>13 and dd<21) and dw$=" monday" then786
784 goto792
786 if yy>1990 then print" presidents' day";:goto 792
788 print" washington's birthday":printtab(23)"observed[145]";
792 if yy>1799 and mm=2 and dd=21 t